package com.lej.dataservice.club.bean.main.home

/**
 *  author: cjq
 *  date  : 2022/7/18 0018
 *  desc  : 购买订单详情
 *  {
"code": "",
"msg": "",
"data": {
"id": "订单id",
"nft_id": "nft_id",
"status": "1支付成功",
"unit": "数量",
"per_fee": "单价单位分",
"post_id": "",
"nick": "创作者昵称",
"name": "nft名称",
"cover": "封面",
"resource": "nft类型地址",
"resource_type": "nft类型：1 图片 2 音频 3 视频 4 3D",
"fee": "总价单位分",
"order_no": "订单号",
"order_time": "下单时间戳",
"delivery_status": "1支付成功0待支付2自动取消订单3手动取消订单",
"order_time_format": "订单时间格式",
"last_pay_time": "最晚支付时间戳"
}
}
 */
data class BuyDetailInfo(
    val id: Int?,
    val nft_id: Int?,
    val status: Int?,
    val unit: Int?,
    val fee: Int?,
    val per_fee: Int?,
    val nick: String?,
    val name: String?,
    val cover: String?,
    val resource_type: Int?,
    val order_no: String?,
    val order_time: Long?,
    val order_time_format: String?,
    val delivery_status: Int?,
    val last_pay_time: Long?,
) {
    fun getNftType() =
        when (resource_type) {
            1 -> "图片"
            2 -> "音频"
            3 -> "视频"
            4 -> "模型"
            else -> "图片"
        }

    fun getStateStr() =
        when (delivery_status) {
            0 -> "待支付"
            1 -> "交易完成"
            2 -> "自动取消订单"
            3 -> "手动取消订单"
            else -> "获取订单状态失败"
        }
}
